/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
using NetProtocol.Enum;

namespace NetProtocol.POD {

	/// <summary>
	/// 
	/// module : levelLogic
	/// </summary>
	public class DelayServicePOD : IPOD 
    {
        public readonly static Func<DelayServicePOD> FACTORY = () => new DelayServicePOD();
		public static Func<DelayServicePOD> DynamicFactory = FACTORY;
        
		/*-- members --*/
		/// <summary>
        /// 
        /// </summary>
		public int serviceCid;
		/// <summary>
        /// 
        /// </summary>
		public int unitIndex;
		/// <summary>
        /// 
        /// </summary>
		public int regionCid;
		/// <summary>
        /// 
        /// </summary>
		public long playerId;
		/// <summary>
        /// 
        /// </summary>
		public int entityId;
		/// <summary>
        /// 
        /// </summary>
		public int leftFrame;
		/// <summary>
        /// 1：真，2：假，3：执行时再实时确定
        /// </summary>
		public int conditionState;
		
		
		
		/*-- constructors --*/
		public DelayServicePOD() {}
		public DelayServicePOD(int serviceCid, int unitIndex, int regionCid, long playerId, int entityId, int leftFrame, int conditionState) {
			this.serviceCid = serviceCid;
			this.unitIndex = unitIndex;
			this.regionCid = regionCid;
			this.playerId = playerId;
			this.entityId = entityId;
			this.leftFrame = leftFrame;
			this.conditionState = conditionState;
		}
	      public void Serial(SOutputStream _out) {
            _out.Write_int(serviceCid);
            _out.Write_int(unitIndex);
            _out.Write_int(regionCid);
            _out.Write_long(playerId);
            _out.Write_int(entityId);
            _out.Write_int(leftFrame);
            _out.Write_int(conditionState);
        }
        
        public void UnSerial(SInputStream _in) {
            if(!_in.HasRemaining()) return;
            serviceCid = _in.Read_int();
            if(!_in.HasRemaining()) return;
            unitIndex = _in.Read_int();
            if(!_in.HasRemaining()) return;
            regionCid = _in.Read_int();
            if(!_in.HasRemaining()) return;
            playerId = _in.Read_long();
            if(!_in.HasRemaining()) return;
            entityId = _in.Read_int();
            if(!_in.HasRemaining()) return;
            leftFrame = _in.Read_int();
            if(!_in.HasRemaining()) return;
            conditionState = _in.Read_int();
        }
		
		public DelayServicePOD Clone() {
            DelayServicePOD o = DynamicFactory();
            o.serviceCid = serviceCid;
            o.unitIndex = unitIndex;
            o.regionCid = regionCid;
            o.playerId = playerId;
            o.entityId = entityId;
            o.leftFrame = leftFrame;
            o.conditionState = conditionState;
            return o;
        }
        
        public void Clear() {
            serviceCid = default;
            unitIndex = default;
            regionCid = default;
            playerId = default;
            entityId = default;
            leftFrame = default;
            conditionState = default;
        }
		
        public override string ToString() {
			string str = "";
			str += "DelayServicePOD [";
			str += "serviceCid=";
			str += serviceCid;
			str += ", unitIndex=";
			str += unitIndex;
			str += ", regionCid=";
			str += regionCid;
			str += ", playerId=";
			str += playerId;
			str += ", entityId=";
			str += entityId;
			str += ", leftFrame=";
			str += leftFrame;
			str += ", conditionState=";
			str += conditionState;
			str += "]";
			return str;
		}
		
	}
}